package com.pet.cloud.order.infrastructure.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pet.cloud.order.infrastructure.entity.SubOrder;
import com.pet.cloud.order.infrastructure.enums.SubOrderStatus;
import com.pet.cloud.order.infrastructure.mapper.SubOrderMapper;
import com.pet.cloud.order.infrastructure.service.SubOrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class SubOrderServiceImpl extends ServiceImpl<SubOrderMapper, SubOrder> implements SubOrderService {


    @Resource
    private SubOrderMapper subOrderMapper;

    @Override
    public void add(String orderNo) {

        SubOrder subOrder = new SubOrder();
        subOrder.setOrderNo(orderNo);
        subOrder.setSubOrderNo("sub_order".concat(orderNo));
        subOrder.setSubOrderStatus(SubOrderStatus.PENDING.getCode());
        this.save(subOrder);

    }
}
